from flask import Flask, render_template

'''
绘制网页表格
'''
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World'


@app.route('/pvuv')
def pvuv():
    data = []
    with open('./data/pvuv.txt') as f:
        linenum = 0
        for row in f:
            if linenum == 0:
                linenum += 1
                continue
            date, pv, uv = row.strip().split(',')
            data.append((date, pv, uv))

    return render_template('pvuv.html', data=data)


if __name__ == "__main__":
    app.run()